﻿using System;
using ParserGenerator.Input;
using ParserGenerator.SyntacticAnalysis;

namespace ParserGenerator.GrammarAnalysis
{
    [Serializable]
    internal sealed class LexicalAlias
    {
        public int Number { get; internal set; }
        public string Name { get; internal set; }
        public SourceContext Context { get; internal set; }
        public LexicalExpression Pattern { get; private set; }

        internal LexicalAlias()
        {
        }

        internal void UpdatePattern(LexicalExpression pattern)
        {
            if (pattern == null)
                throw new ArgumentNullException(nameof(pattern));
            Pattern = pattern;
        }

        public sealed override string ToString()
        {
            return Name;
        }
    }
}
